<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Controllers\Controller;

use Jlylb\ActionLog\Models\ActionLog as UserLog;

class UserLogController extends Controller
{
    public function index(Request $request)
    {
        $perPage = $request->input('pageSize',15);

        $query = UserLog::query();   

        $created = $request->input('created_at', []);

        if(!empty($created)) {
            $query->whereBetween('updatetime', $created);
        }
               
        $company = $request->input('company');

        $site = $request->input('site');
        
        $query->company($company)->site($site);

        $query->uid();
        
        $logs = $query->orderBy('updatetime', 'desc')->paginate($perPage);
        
        return $this->success('', [ 'data'=>$logs ]);
    }
}
